package android.microblog.Adapter;

import java.util.List;

import android.content.Context;
import android.database.DataSetObserver;
import android.microblog.Data.UserInfo;
import android.microblog.Views.UserSpinnerAdapterView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SpinnerAdapter;

public class UserSpinnerAdapter implements SpinnerAdapter {
	private Context context = null;
	private List<UserInfo> list = null;

	public UserSpinnerAdapter(Context c, List<UserInfo> list) {
		this.context = c;
		this.list = list;
	}

	public int getCount() {
		return list.size();
	}

	public Object getItem(int position) {
		return list.get(position);
	}

	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getDropDownView(int position, View convertView, ViewGroup parent) {
		UserInfo user = list.get(position);

		return new UserSpinnerAdapterView(this.context, user);
	}

	@Override
	public int getItemViewType(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int getViewTypeCount() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public boolean hasStableIds() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isEmpty() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void registerDataSetObserver(DataSetObserver arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void unregisterDataSetObserver(DataSetObserver observer) {
		// TODO Auto-generated method stub

	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		UserInfo user = list.get(position);

		return new UserSpinnerAdapterView(this.context, user);
	}
}
